home *** CD-ROM | disk | FTP | other *** search
/ Celestin Apprentice 2 / Apprentice-Release2.iso / Tools / Helpers / VersionEdit 1.0 / Project Includes / ProductInformation.c next >
Encoding:
Text File  |  1994-05-02  |  1.3 KB  |  90 lines  |  [TEXT/MPS ]

  1.  
  2. // ProductInformation.c
  3. // Defines for Accessing Product Information
  4. // April 27, 1994
  5.  
  6. // Copyright © 1994, Teknosys, Inc.
  7.  
  8.  
  9. #include    <Errors.h>
  10. #include    <Files.h>
  11. #include    <Memory.h>
  12. #include    <Resources.h>
  13. #include <Types.h>
  14.  
  15. #include "ProductInformation.h"
  16.  
  17.  
  18. long GetVersionNumber(short versionID)
  19. {
  20.     long        result;
  21.     Handle    hVersion;
  22.  
  23.     hVersion = GetResource(kVersionResType, versionID);
  24.  
  25.     if (hVersion)
  26.     {
  27.         result = *(long*) *hVersion;
  28.  
  29.         ReleaseResource(hVersion);
  30.     }
  31.     else
  32.         result = 0;
  33.  
  34.     return (result);
  35. }
  36.  
  37.  
  38. OSErr GetVersionNumberString(short versionID, Str255 str)
  39. {
  40.     OSErr            error;
  41.     Handle        hVersion;
  42.     StringPtr    ptr;
  43.  
  44.     hVersion = GetResource(kVersionResType, versionID);
  45.  
  46.     if (hVersion)
  47.     {
  48.         HLock(hVersion);
  49.  
  50.         ptr = (StringPtr) (*hVersion + sizeof(NumVersion) + sizeof(short));
  51.  
  52.         BlockMove(ptr, str, ptr[0] + 1);
  53.  
  54.         ReleaseResource(hVersion);
  55.     }
  56.     else
  57.         error = resNotFound;
  58.  
  59.     return (error);
  60. }
  61.  
  62.  
  63. OSErr GetVersionMessage(short versionID, Str255 message)
  64. {
  65.     OSErr            error;
  66.     Handle        hVersion;
  67.     StringPtr    ptr;
  68.  
  69.     hVersion = GetResource(kVersionResType, versionID);
  70.  
  71.     if (hVersion)
  72.     {
  73.         HLock(hVersion);
  74.  
  75.         ptr = (StringPtr) (*hVersion + sizeof(NumVersion) + sizeof(short));
  76.         ptr += ptr[0] + 1;
  77.  
  78.         BlockMove(ptr, message, ptr[0] + 1);
  79.  
  80.         ReleaseResource(hVersion);
  81.     }
  82.     else
  83.         error = resNotFound;
  84.  
  85.     return (error);
  86. }
  87.  
  88.  
  89.  
  90.